package com.itcast.main.mq;

import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.MessageListener;

import org.springframework.stereotype.Service;

import com.itcast.main.utils.SmsUtils;


@Service("sms")
public class SmsConsumer implements MessageListener{

	@Override
	public void onMessage(Message message) {

		MapMessage mapMessage  = (MapMessage) message;
		
		try {
			SmsUtils.sendSms(mapMessage.getString("telephone"), mapMessage.getString("code"));
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
